import {
  queryList,
  deleteById
} from './service';

export default {
  namespace: 'sysLogs',
  state: {
    data: {
      list: [],
      pagination: {}
    }
  },
  effects: {
    *fetch({ payload }, { call, put }) {
      const response = yield call(queryList, payload);
      yield put({
        type: 'save',
        payload: response
      });
    },
    *deleteById({ payload }, { call, put }) {
      return yield call(deleteById, payload);
    },
  },
  reducers: {
    save(state, action) {
      return {
        ...state,
        data: action.payload.data
      };
    }
  },
}
